<template>
  <div class="pdf">
    <div id="pdfdemo"></div>
  </div>
</template>

<script>
// import Pdfh5 from "pdfh5";
// import "pdfh5/css/pdfh5.css";

export default {
  alias: "HPdf",
  name: "HPdf",
  props: {
    pdfUrl: {
      required: true,
      type: String,
      default: "",
    },
    options: {
      type: Object,
      default: () => {
        return {
          scale: 5,
          renderType: 'canvas'
        }
      }
    }
  },
  data() {
    return {
      pdfh5: null,
    };
  },
  mounted() {
    const options = Object.assign(this.options, { pdfurl: this.pdfUrl })
    this.pdfh5 = new Pdfh5("#pdfdemo", options)
    this.pdfh5.scrollEnable(false)
  },
  methods: {
    getInstance() {
      return this.pdfh5
    }
  }
};
</script>

<style lang="scss" scoped>
.pdf {
  padding: 0;
  margin: 0;
  width: 100%;
  height: 100%;
}
</style>
